import request from '@/utils/request'

//HTTP 接口权限相关

export function getActionsWithPage(page) {
  return request({
    url: '/watchdog/actions',
    params: page,
  })
}

//获取单个action信息
export function getActionById(id) {
  return request({
    url: '/watchdog/actions/' + id
  })
}

//删除action
export function deleteActionById(id) {
  return request({
    url: '/watchdog/actions',
    method: 'delete',
    params: {
      id: id
    }
  })

}

//新增接口
export function addAction(data) {
  return request({
    url: '/watchdog/actions',
    method: 'post',
    data: data
  })
}

//保存接口
export function updateAction(data) {
  return request({
    url: '/watchdog/actions',
    method: 'put',
    data: data
  })
}

//获取APP名字
export function getAppNames() {
  return request({
    url: '/watchdog/actions',
    params: {
      query_type: 'appNames'
    }
  })
}

//重载所有接口
export function resetRoleActions(resetType) {
  return request({
    url: '/watchdog/actions',
    method: 'put',
    params: {
      reset_type: resetType
    }
  })
}
